home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97a.txt
/
000131_icon-group-sender _Tue Jun 10 09:34:24 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Tue, 10 Jun 1997 12:27:50 MST
Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM)
id AA08354; Tue, 10 Jun 1997 12:27:50 -0700
Date: Tue, 10 Jun 1997 09:34:24 -0700
From: swampler@noao.edu (Steve Wampler)
Subject: Re: searching with variables
To: icon-group@cs.arizona.edu
Message-Id: <swampler-9705101634.AA002714681@orpheus.gemini.edu>
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Content-Length: 1654
- Forwarded message from Stuart.Robinson@anu.edu.au on Tue, 10 Jun 1997 22:30:39 +1000 -
>
> A quick question. If you wanted to use the function find() to search for
> a particular strings of characters, how would it be possible to define
> character variables? For example, suppose you want to search for the
> following sequences
>
> al
> el
> il
> ol
> ul
>
> which are really just Vl (where V stands for a vowel). Could you simply
> define a character set for vowels (V := 'aeiou') and then refer to that
> character set in the find() function? If so, what would it look like? I
> tried something like the following and it didn't work.
>
> find( V || "l")
>
> I realise it's a pretty trivial task but I don't have the manual at the
> moment and I'd like an answer within the next couple of days. Thanks in
> advance.
You can try:
find( !V || "l" )
which will work, *but*, the order of the two generators (find and !) means
that you will look throughout the subject for the first string ("al") before
backtracking and looking throughout the subject for the second string ("el"),
etc. This means you find "al" anywhere in the subject before finding "el"
anywhere in the subject. All occurrences will be found, just not necessarily
in the order you might have expected.
It's an interesting exercise to come up with a clean approach that locates
any of "al","el","il","ol","ul" in the order they appear in the subject.
Perhaps others can suggest solutions to this?
--
Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)]
O Sibile, si ergo, fortibus es inero.
Nobile, demis trux. Demis phulla causan dux.